<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <script>

        //JavaScript 会自动将基本字符串转换为字符串对象，只有将基本字符串转化为字符串对象之后才可以使用字符串对象的方法。
        let str1 = "foo";
        let strObj = new String(str1);
        console.log(typeof str1)    //string
        console.log(typeof strObj)  //object

        //需求：将字符串对象转换为基本字符串
        const strObj2 = new String("haha")
        console.log(strObj2)
        const str2 = strObj2.valueOf();
        console.log(str2)


    </script>
</head>
<body>
    
</body>
</html>